<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	template="/layout/page/sample/left-right-template.xhtml">
	<ui:param name="compId" value="#{commonContentViewBean.id}" />
	<ui:define name="compLeft">
		<h:form style="margin:0;" id="#{compId}_left_form">
			<ui:decorate
				template="/layout/iteration/tree/sino-tree-single-template.xhtml">
				<ui:param name="compId" value="#{commonContentViewBean.id}_tree" />
				<ui:param name="compViewBean" value="#{commonContentViewBean}" />
				<ui:param name="compSelectedNodeUpdate"
					value="#{commonContentViewBean.id}_right_form:#{commonContentViewBean.id}_right_main,#{commonContentViewBean.id}_right_form:#{commonContentViewBean.id}_right_bread" />
			</ui:decorate>
		</h:form>
	</ui:define>

	<ui:define name="compRight">
		<h:form style="margin:0;" id="#{compId}_right_form">
			<p:toolbar id="#{compId}_right_toolbar" height="30px">
				<p:toolbarGroup align="left" style="margin-left:5px;">
					<p:breadCrumb id="#{compId}_right_bread"
						style="width:500px;padding:0;border:0 none;background:none repeat scroll 0 0 transparent;">
						<c:forEach items="#{commonContentViewBean.currentNodeHiberarchy}"
							var="node">
							<p:menuitem value="#{node.data.name}"
								onclick="#{compId}_changeCurrentNode('#{compId},#{node.data.id}')" />
						</c:forEach>
					</p:breadCrumb>
				</p:toolbarGroup>

				<p:toolbarGroup align="right">
					<p:commandButton title="添加目录" value="添加目录"
						styleClass="portal-toolbar-button" type="button"
						onclick="SinoPortal.View.createWin('writ-scene','writ-edit-dir','#{compId}',{type:'createdir',displayName:'新建目录'})" />
					
					<p:commandButton title="删除目录" value="删除目录"
						styleClass="portal-toolbar-button" type="button"
						onclick="V3.Writ.delWritDir('#{compId}')" />
					<p:commandButton title="添加文书" value="添加文书"
						styleClass="portal-toolbar-button" type="button"
						onclick="SinoPortal.View.createWin('writ-scene','writ-edit-layout','#{compId}',{type:'create',displayName:'添加文书'})" />

					<p:commandButton title="修改文书" value="修改文书"
						styleClass="portal-toolbar-button" type="button"
						onclick="V3.Writ.editWritNode('#{compId}')" />

					<p:commandButton title="删除文书" value="删除文书"
						styleClass="portal-toolbar-button" type="button"
						onclick="V3.Writ.delWrit('#{compId}')" />

				</p:toolbarGroup>
			</p:toolbar>
 
			<h:panelGroup id="#{compId}_right_main" layout="block"
				style="width:100%;">
				<ul id="#{compId}_right_main_ul" class="portal-dataview-ul">
					<ui:repeat value="#{commonContentViewBean.currentWritDir}"
						var="node">
						<li id="#{compId},#{node.type},#{node.id},#{node.name}"
							style="width: 100px; height: 100px; cursor: pointer;"
							onmouseover="jQuery(this).addClass('portal-dataview-li-hover')"
							onmouseout="jQuery(this).removeClass('portal-dataview-li-hover')"
							ondblclick="#{compId}_#{node.type}ChangeCurrentNode('#{compId},#{node.id}')"
							onclick="SinoPortal.PageView.dataView.click('#{compId}_right_main_ul',this)"
							class="portal-dataview-li"><p:graphicImage
							value="/img/document/#{node.type}.png"
							style="margin:5px;width:64px;height:64px;" /> <br />
						<h:outputText value="#{node.name}" /></li>
					</ui:repeat>

				</ul>
			</h:panelGroup> 
			 
			<p:remoteCommand name="#{compId}_changeCurrentNode"
				actionListener="#{documentManageAction.changeCurrentNodeByPath}"
				update="#{compId}_right_main,#{compId}_right_bread,#{compId}_left_form">
			</p:remoteCommand>
			<p:remoteCommand name="#{compId}_nodeChangeCurrentNode"
				actionListener="#{documentManageAction.changeCurrentNode}"
				update="#{compId}_right_main,#{compId}_right_bread,#{compId}_left_form">
			</p:remoteCommand>
			<p:remoteCommand name="#{compId}_leafChangeCurrentNode"
				oncomplete="V3.Writ.editWritNode('#{compId}')">
			</p:remoteCommand>


			<p:remoteCommand name="#{compId}_deleteSelectedNode"
				actionListener="#{documentManageAction.deleteSelectedNode}"
				update="#{compId}_right_main">
			</p:remoteCommand>
			<p:remoteCommand name="#{compId}_delWritDir"
				actionListener="#{documentManageAction.deleteWritDirAction}"
				update="#{compId}_right_main,#{compId}_right_bread,#{compId}_left_form">
			</p:remoteCommand>

			<p:confirmDialog message="delete" styleClass="portal-confirmation"
				closable="false" header="警告" showEffect="bounce" hideEffect="puff"
				severity="alert" widgetVar="#{compId}_delWrit">
				<p:commandButton value="确定"
					onclick="SinoComponent.Bpm.submitDeleteDirOrFile('#{compId}')"
					type="button" />
				<p:commandButton value="取消" onclick="#{compId}_delete.hide()"
					type="button" />
			</p:confirmDialog>
		</h:form>
	</ui:define>
</ui:composition>